<?php

class TbfChineseNumberTest extends TbfTestCase{
    function test1(){
        foreach(array(
                    2004=>'二零零四',
                    23040602=>'二三零四零六零二',
                ) as $in=>$expect){
            $get = TbfChineseNumber::DigestToChineseNumberByChar($in);
            $this->assertSame($expect,$get,'DigestToChineseNumberByChar');
        }

        foreach(array(
                    0.01=>'零',
                    1=>'一',
                    10=>'十',
                    101=>'一百零一',
                    111=>'一百十一',
                    10000=>'一万',
                    100000=>'十万',
                    1000000=>'一百万',
                    10000000=>'一千万',
                    100000000=>'一亿',
                    100000001=>'一亿零一',
                    100000010=>'一亿零十',
                    100000100=>'一亿零一百',
                    100001000=>'一亿零一千',
                    100010000=>'一亿零一万',
                    100100000=>'一亿零十万',
                    101000000=>'一亿零一百万',
                    110000000=>'一亿一千万',
                    1234567890=>'十二亿三千四百五十六万七千八百九十',
                    2004=>'二千零四',
                    23040602=>'二千三百零四万零六百零二',
                ) as $in=>$expect){
            $get = TbfChineseNumber::NumToChineseNumber($in);
            if ($expect!=$get){
                echo 'NumToChineseNumber fail expect:'.$expect.' get:'.$get."\n";
            }
        }

        foreach(array(
                    2004=>'贰仟零肆',
                    23040602=>'贰仟叁佰零肆萬零陆佰零贰',
                ) as $in=>$expect){
            $get = TbfChineseNumber::NumToBiggerChineseNumber($in);
            if ($expect!=$get){
                echo 'NumToBiggerChineseNumber fail expect:'.$expect.' get:'.$get."\n";
            }
        }
    }
}
